package com.computaris.entities;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

import com.computaris.ws.ResultCode;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SubscriberDetails")
public class SubscriberDetails extends Subscriber {
	
	@XmlAttribute(name="SubscriptionName")
	private String subscriptionName = null;
	
	@XmlAttribute(name="SubscriberStatus")
	private Integer subscriberStatus = null;
	
	@XmlAttribute(name="Description")
	private String description = null;
	
	public String getSubscriptionName() {
		return subscriptionName;
	}
	public void setSubscriptionName(String subscriptionName) {
		this.subscriptionName = subscriptionName;
	}
	
	public void setSubscriberDetails(Subscriber sb){
		this.setId(sb.getId());
		this.setImsi(sb.getImsi());
		this.setMsisdn(sb.getMsisdn());
		this.setUpdateDate(sb.getUpdateDate());
		this.setSubscriberStatus(sb.getStatus());
		
		// truncate status name if it's length is more than 15 chars
		String subscriptionName = sb.getSubscription().getName();
		if(subscriptionName.length()>15){
			subscriptionName = subscriptionName.substring(0,15);
		}		
		this.setSubscriptionName(subscriptionName);
	}
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	public int getSubscriberStatus() {
		return subscriberStatus;
	}
	public void setSubscriberStatus(int subscriberStatus) {
		this.subscriberStatus = subscriberStatus;
	}

}
